package com.ruoyi.project.system.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.system.domain.SysArea;
import com.ruoyi.project.system.service.ISysAreaService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;

/**
 * 【请填写功能名称】Controller
 *
 * @author theme
 * @date 2020-06-24
 */
@Api(description = "【请填写功能名称】Controller")
@RestController
@RequestMapping("/system/area")
public class SysAreaController extends BaseController {
    @Autowired
    private ISysAreaService sysAreaService;


    /**
     * 查询【请填写功能名称】列表
     */
    @ApiOperation("查询【请填写功能名称】列表")
    @PreAuthorize("@ss.hasPermi('system:area:list')")
    @GetMapping("/list")
    public AjaxResult list(SysArea sysArea) {
        return AjaxResult.success(sysAreaService.selectSysAreaList(sysArea));
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @ApiOperation("获取【请填写功能名称】详细信息")
    @PreAuthorize("@ss.hasPermi('system:area:query')")
    @GetMapping(value = "/{areaId}")
    public AjaxResult getInfo(@PathVariable("areaId") Long areaId) {
        return AjaxResult.success(sysAreaService.selectSysAreaById(areaId));
    }

    /**
     * 新增【请填写功能名称】
     */
    @ApiOperation("新增【请填写功能名称】")
    @PreAuthorize("@ss.hasPermi('system:area:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysArea sysArea) {
        return toAjax(sysAreaService.insertSysArea(sysArea));
    }

    /**
     * 修改【请填写功能名称】
     */
    @ApiOperation("修改【请填写功能名称】")
    @PreAuthorize("@ss.hasPermi('system:area:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysArea sysArea) {
        return toAjax(sysAreaService.updateSysArea(sysArea));
    }

    /**
     * 删除【请填写功能名称】
     */
    @ApiOperation("删除【请填写功能名称】")
    @PreAuthorize("@ss.hasPermi('system:area:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
    @DeleteMapping("/{areaIds}")
    public AjaxResult remove(@PathVariable Long[] areaIds) {
        return toAjax(sysAreaService.deleteSysAreaByIds(areaIds));
    }

    /**
     * 查询所有的省列表
     * 根据传递不同id
     */
    @ApiOperation("查询【请填写功能名称】列表")
    @PreAuthorize("@ss.hasPermi('system:area:queryList')")
    @PostMapping("/queryList")
    public AjaxResult queryAllDate(@RequestBody SysArea sysArea) {
        return AjaxResult.success(sysAreaService.queryAllData(sysArea));
    }
/*

    */
/**
     * 查询所有的省列表
     * 根据传递不同id
     *//*

    @ApiOperation("查询【请填写功能名称】列表")
    @PreAuthorize("@ss.hasPermi('system:area:queryList')")
    @PostMapping("/queryList")
    public AjaxResult queryProvinceDate(@RequestBody SysArea sysArea) {
        return AjaxResult.success(sysAreaService.queryProvinceData(sysArea));
    }

    */
/**
     * 查询所有的市列表
     * 根据传递不同id
     *//*

    @ApiOperation("查询【请填写功能名称】列表")
    @PreAuthorize("@ss.hasPermi('system:area:queryList')")
    @PostMapping("/queryList")
    public AjaxResult queryCityDate(@RequestBody SysArea sysArea) {
        return AjaxResult.success(sysAreaService.queryCityData(sysArea));
    }
    */
/**
     * 查询所有的区列表
     * 根据传递不同id
     *//*

    @ApiOperation("查询【请填写功能名称】列表")
    @PreAuthorize("@ss.hasPermi('system:area:queryList')")
    @PostMapping("/queryList")
    public AjaxResult queryAreaDate(@RequestBody SysArea sysArea) {
        return AjaxResult.success(sysAreaService.queryAreaData(sysArea));
    }
*/

}
